package twentytwentyone_3;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @Author: Zahi
 * @Description:
 * @Date Created in 2021-03-06 11:06
 * @Modified By:
 */
public class FindMaxConsecutiveOnes_485 {

    public static void main(String [] args){
        int [] nums = new int[]{0,1};
        System.out.println(findMaxConsecutiveOnes(nums));
    }

    public static int findMaxConsecutiveOnes(int [] nums){
        int result = 0;
        int count = 0;
        for (int num : nums) {
            if (num == 1){
                count++;
                if (result < count) result = count;
            }else {
                count = 0;
            }
        }
        return result;
    }
}
